package com.anuqing.alibaba.provider.sentinel.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author gdsunfly_wangquanqing
 * @since 2021/4/18 22:25
 */
@RestController
@RequestMapping("/sentinelResource")
public class SentinelResourceController {


    @SentinelResource(value = "hello",blockHandler = "blockHandlerHello")
    @GetMapping(value = "/hi")
    public String sayHi() {
        return "Hello Wang";
    }

    public String blockHandlerHello(BlockException be){
        return "被限流了";
    }


}
